app.controller('ComplaintListCtrl', function ($scope, $rootScope) {

	$scope.queryMap = {};

	$scope.reload = $scope.page.loader('complaint/{pageIndex}/{pageSize}/page');
	$scope.$on('pageIndex', function (event, p) { $scope.reload(p, $scope.queryMap); });
	$scope.query = function () { $scope.reload(1, $scope.queryMap); };

    (function() {
		$scope.auths = $rootScope.loginUser.auths;
        $scope.ms = [];
        for (var i = 0; i < $scope.auths.length; i++) {
            if ($scope.auths[i] == "AUTH_BOOKING_COPLAINT") {
                $scope.ms.push(1);
            }
            if ($scope.auths[i] == "AUTH_RENT_COPLAINT") {
                $scope.ms.push(2);
            }
            if ($scope.auths[i] == "AUTH_BUS_COPLAINT") {
                $scope.ms.push(3);
            }
        }
        $scope.queryMap.module__ids = $scope.ms;
    })();
    $scope.reload(1, $scope.queryMap);
});
